#pragma once

#include <string>
#include <memory>
#include <cstdlib>
#include <cstring>
#include <sstream>

constexpr unsigned UNSIGNED_MAX = -1;
constexpr long long LLONG_MIN = 1LL << (sizeof(long long) * 8 - 1);
constexpr int INT_LENGTH = sizeof(int) * 8;
constexpr int LLONG_LENGTH = sizeof(long long) * 8;

class BigInteger {

friend BigInteger operator+(const BigInteger&, const BigInteger&);
friend BigInteger operator-(const BigInteger&, const BigInteger&);
friend bool operator==(const BigInteger&, const BigInteger&);
friend bool operator<(const BigInteger&, const BigInteger&);

private:
    bool positive;
    int size;
    int capacity;
    std::unique_ptr<unsigned[]> data;
    void setCapacity(int);

public:
    BigInteger();
    BigInteger(long long);
    BigInteger(std::string);
    BigInteger(const char*);
    BigInteger(const BigInteger&);
    BigInteger(BigInteger&&) noexcept;
    std::string hex_str();
};

BigInteger operator"" _big(const char* str, size_t size);
BigInteger operator+(const BigInteger &lhs, const BigInteger &rhs);
BigInteger operator-(const BigInteger &lhs, const BigInteger &rhs);
bool operator==(const BigInteger &lhs, const BigInteger &rhs);
bool operator<(const BigInteger &lhs, const BigInteger &rhs);
bool operator>(const BigInteger &lhs, const BigInteger &rhs);


